#include "uhm/common.hxx"
#include "uhm/util.hxx"
#include "uhm/mat.hxx"

#include "uhm/mat/linal.hxx"

using namespace uhm;

int main (int argc, char **argv) {

  initialize(argc, argv);
  Int_ mt = 5, mb = 3, rhs = 1, blk = 3;
  UHM_Linal_ A(Mat_Base_::DOUBLE, mt, mb, rhs, blk);
  A.create_flat_without_buffer();
  A.create_flat_buffer();
  A.create_hier();

  Double_ storage, max_storage;
  storage_counter(storage, max_storage);
  std::cout << "Storage = " << storage << ", " << max_storage << "  Bytes\n";

  random_matrix(A);
  std::cout << A;

  UHM_Linal_ B(A);
  B.create_flat_without_buffer();
  B.create_flat_buffer();
  B.create_hier();
  

  copy(A, B);
  axpy(-1, B, A);
  
  std::cout << A;
  
  A.free_all();
  B.free_all();
  
  finalize();
  return true;
}


